package Homework2;

interface Perarea 
{
    double get_area();
    double get_perimeter();
}

class Rectangle implements Perarea
{
    private double _length;
    private double _width;

    public Rectangle(double length, double width)
    {
        this._length = length;
        this._width = width;
    }

    public double get_area()
    {
        return this._length * this._width;
    }

    public double get_perimeter()
    {
        return 2 * (this._length + this._width);
    }
}

class Circle implements Perarea {
    private double radius;

    public Circle(double radius) {
        this.radius = radius;
    }

    public double get_area() {
        return Math.PI * radius * radius;
    }

    public double get_perimeter() {
        return 2 * Math.PI * radius;
    }
}

public class Demo1 {
    public static void main(String[] args) {
        Rectangle rec = new Rectangle(10, 5);
        Circle cir = new Circle(5);

        Perarea[] perareas = new Perarea[2];
        perareas[0] = rec;
        perareas[1] = cir;

        for (Perarea p : perareas) {
            System.out.println("Area: " + p.get_area());
            System.out.println("Perimeter: " + p.get_perimeter());
            System.out.println();
        }
    }
}